package com.sh3h.generator.web.dtos;

import com.sh3h.generator.web.domain.GenFieldType;

import java.io.Serializable;
import java.util.Date;

/**
 * 字段类型管理
 * @TableName gen_field_type
 */
public class GenFieldTypeDto implements Serializable {
    /**
     * id
     */
    private Long id;

    /**
     * 字段类型
     */
    private String columnType;

    /**
     * 属性类型
     */
    private String attrType;

    /**
     * 属性包名
     */
    private String packageName;

    /**
     * 创建时间
     */
    private Date createTime;

    private static final long serialVersionUID = 1L;

    /**
     * id
     */
    public Long getId() {
        return id;
    }

    /**
     * id
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * 字段类型
     */
    public String getColumnType() {
        return columnType;
    }

    /**
     * 字段类型
     */
    public void setColumnType(String columnType) {
        this.columnType = columnType;
    }

    /**
     * 属性类型
     */
    public String getAttrType() {
        return attrType;
    }

    /**
     * 属性类型
     */
    public void setAttrType(String attrType) {
        this.attrType = attrType;
    }

    /**
     * 属性包名
     */
    public String getPackageName() {
        return packageName;
    }

    /**
     * 属性包名
     */
    public void setPackageName(String packageName) {
        this.packageName = packageName;
    }

    /**
     * 创建时间
     */
    public Date getCreateTime() {
        return createTime;
    }

    /**
     * 创建时间
     */
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public static GenFieldType ToModal(GenFieldTypeDto dto){
        GenFieldType datasource=new GenFieldType();
        datasource.setId(dto.getId());
        datasource.setAttrType(dto.getAttrType());
        datasource.setColumnType(dto.getColumnType());
        datasource.setCreateTime(dto.getCreateTime());
        datasource.setPackageName(dto.getPackageName());
        datasource.setId(dto.getId());
        return datasource;
    }
    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        GenFieldTypeDto other = (GenFieldTypeDto) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getColumnType() == null ? other.getColumnType() == null : this.getColumnType().equals(other.getColumnType()))
            && (this.getAttrType() == null ? other.getAttrType() == null : this.getAttrType().equals(other.getAttrType()))
            && (this.getPackageName() == null ? other.getPackageName() == null : this.getPackageName().equals(other.getPackageName()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getColumnType() == null) ? 0 : getColumnType().hashCode());
        result = prime * result + ((getAttrType() == null) ? 0 : getAttrType().hashCode());
        result = prime * result + ((getPackageName() == null) ? 0 : getPackageName().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", columnType=").append(columnType);
        sb.append(", attrType=").append(attrType);
        sb.append(", packageName=").append(packageName);
        sb.append(", createTime=").append(createTime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}